from fastapi import FastAPI, Query, Path, Body
from pydantic import BaseModel, Field
import uvicorn
from typing import Union
# from pydantic import Required


class Item(BaseModel):
    name: str
    description: str | None = None
    price: float
    tax: float | None = None


app = FastAPI()


@app.put("/items/{item_id}")
async def update_item(item_id:str = Path(...), item: Item=Body(...)):
    return {"item_id": item_id, **item.dict()}

if __name__ == "__main__":
    uvicorn.run(app, host="0.0.0.0", port=8000)